Combine gelatin and marshmallows in a bowl; add boiling water and set aside until gelatin and marshmallows are dissolved. Stir pineapple and bananas into gelatin mixture and pour into a 9x13-inch casserole dish. Refrigerate until set and firm, at least 2 hours.
Combine sugar, egg, butter, and flour in a saucepan over low heat; cook and stir until thickened, about 10 minutes. Remove saucepan from heat and beat cream cheese into mixture using an electric mixer until smooth. Refrigerate topping until completely cooled, at least 15 minutes. Fold whipped topping into topping and spread over gelatin mixture; refrigerate 8 hours to overnight.