WICKET-5704 IllegalArgument exception with wicket:child in ajaxrequest

(cherry picked from commit 572df1583add7b8e34aa412e9e554031a74231f0)